<template>
	<view>
		<u-navbar :border-bottom='false' back-icon-size='48' title="我的订单"></u-navbar>
		<u-tabs :list="list" :is-scroll="false" active-color="#333333" bar-height='4' bar-width='64'
			:bar-style='barStyle' :current="current" @change="tabsChange" :bold='false'></u-tabs>
		<view class="order-list">
			<navigator url="./fillOrderDetail" class="order-item" v-for="(item,index) in orderList" :key='index'>
				<view class="title">
					<text>{{item.orderSource}}</text>
					<text class="status">{{item.orderStatusName}}</text>
				</view>
				<view class="station-item">
					<image :src="item.gas_info.gas_logo_big" class="image"></image>
					<view class="info">
						<view class="title">{{item.gasName}}</view>
						<view class="address">{{item.gas_info.gas_address}}</view>
						<view class="detail">
							<!-- <view class="huaxian">汽油</view> -->
							<view class="huaxian">{{item.oilNo}}</view>
						</view>
					</view>
				</view>
				<view class="price">￥{{item.amountPay}}</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	import myRequest from '@/api/index.js'
	export default {
		data() {
			return {
				current: 0,
				barStyle: {
					background: 'linear-gradient(180deg, #6ABCFC 0%, #048FFE 100%)'
				},
				orderList: [],
				list: [{
						name: '全部'
					},
					{
						name: '已支付'
					},
					{
						name: '退款'
					}
				],
				page: '1',
				type: ''
			};
		},
		onLoad() {
			this.getOilOrder()
		},
		methods: {
			async getOilOrder() {
				let {
					page,
					type
				} = this
				let res = await myRequest.getoilOrder({
					page: page,
					order_status: type.toString()
				})
				if (res.status) {
					console.log(res)
					this.orderList = res.data
				}
			},
			tabsChange(e) {
				this.current = e
				if (e == 1) {
					this.type = 1
				}
				if (e == 2) {
					this.type = 5
				}
				this.getOilOrder()
			}
		}
	}
</script>

<style lang="scss">
	.order-list {
		padding: 0 20rpx;

		.order-item {
			margin-top: 20rpx;
			background-color: #FFFFFF;
			padding: 20rpx;

			.title {
				display: flex;
				align-items: center;
				justify-content: space-between;
				color: #333333;

				.status {
					color: #666666;
				}
			}

			.station-item {
				border-radius: 20rpx;
				background-color: #FFFFFF;
				display: flex;
				align-items: center;
				justify-content: flex-start;
				margin-top: 20rpx;

				.image {
					width: 120rpx;
					height: 120rpx;
				}

				.info {
					display: flex;
					align-items: flex-start;
					justify-content: space-between;
					flex-direction: column;
					margin-left: 20rpx;

					.title {
						color: #333333;
						font-weight: bold;
						margin-bottom: 10rpx;
					}

					.address {
						color: #999999;
						font-weight: 400;
						margin-bottom: 10rpx;
					}

					.detail {
						display: flex;
						align-items: center;
						justify-content: space-between;

						.huaxian {
							color: #9f9f9f;
							font-size: 26rpx;
							margin-left: 10rpx;
						}
					}
				}

			}

			.price {
				text-align: right;
				width: 100%;
				color: #333333;
				font-weight: bold;
			}
		}
	}
</style>
